import { cdnBase } from '../config/index';

const imgPrefix = cdnBase;

const defaultDesc = [`${imgPrefix}/goods/details-1.png`];

const allReviews = [
  {
    groupId: 210101,
    groupChain: '校园美食 食堂一层 快餐厅',
    reviewsId: '52501001',
    title: '自由快乐被卷进TACO里',
    primaryImage: 'https://img.meituan.net/content/2ab4b19eb3afcaaa742927c9db125cbb1241379.png',
    reviewContext:
      '美食文化需要碰撞，而TACO属于最喜欢碰撞的一种美食了。作为墨西哥街头特色的小吃之一，油腻与清爽的碰撞，现代与传统的碰撞……',
    images: [
      'https://qcloud.dpfile.com/pc/MwZOx7HJjoxfHV7D87hiRoIQaRSZIdg6fULnhlxXscmx6CJbDMzuLvbsbXyIeVdn0scohmss9LtJWg-k-u7I4UHdS9p3h7-h2wfpsWVfxX8nY08TQIxe-DkxF3-YDtNHvJLBPMnbGaim65JmQfWVIQ.jpg',
      'https://qcloud.dpfile.com/pc/mTnsX-hGfuFlyKEXwu3m9qjciNxhsWCrO-jLr3CdSqrmLdJDs7FZJYyzEaDeek-N0scohmss9LtJWg-k-u7I4UHdS9p3h7-h2wfpsWVfxX8nY08TQIxe-DkxF3-YDtNHvJLBPMnbGaim65JmQfWVIQ.jpg',
    ],
    likerNum: 192,
    author: '甜莓小茶茶',
    avatar: 'https://p0.meituan.net/userheadpicbackend/1004cc9bb09a55a3558d10387eba73f8251820.jpg',
    releaseTime: '2024-04-29',
    lastModifyTime: '2024-04-29 13:49:51',
    subcategory: [''],
    isHot: true,
    mark: 4.5,
    comments: [
      {
        commentator: '',
        commentatorAvatar: '',
        commentContext: '',
        commentIssusTime: '',
      },
    ],
  },
  {
    groupId: 210101,
    reviewsId: '52501002',
    title: '整体口味与重庆还原度非常高',
    primaryImage:
      'https://qcloud.dpfile.com/pc/llpsIBcCrfOPG5V5HbXj6fWiOKwgbpb-Bo48KkW4QghaGEp6KxG-mWNJhJlVr9On0scohmss9LtJWg-k-u7I4UHdS9p3h7-h2wfpsWVfxX8nY08TQIxe-DkxF3-YDtNHvJLBPMnbGaim65JmQfWVIQ.jpg',
    reviewContext: '整体口味与重庆还原度非常高，而且里的蔬菜都是从原产地发货，本市采购不到的。原汁原味！',
    images: [
      'https://qcloud.dpfile.com/pc/WPmMHfahXTPxn4pJQ8yNhWAM-hkYJcoWoda6tUCh52yO3MjNCxoHTfR3RqMY9K5i0scohmss9LtJWg-k-u7I4UHdS9p3h7-h2wfpsWVfxX8nY08TQIxe-DkxF3-YDtNHvJLBPMnbGaim65JmQfWVIQ.jpg',
      'https://qcloud.dpfile.com/pc/vYEHe7uyYpcjpjLG4BXs2QzVWUtdZTLRSH3s3Ok4jEG-6zXt4WIIgT93Hq3sVh9P0scohmss9LtJWg-k-u7I4UHdS9p3h7-h2wfpsWVfxX8nY08TQIxe-DkxF3-YDtNHvJLBPMnbGaim65JmQfWVIQ.jpg',
    ],
    likerNum: 45,
    author: '正在发财的韩小艾',
    avatar: 'https://p1.meituan.net/userheadpicbackend/67e14696c206ef5d992b396a700855f7146352.jpg',
    releaseTime: '2024-04-29',
    lastModifyTime: '2024-04-29 13:49:51',
    subcategory: [''],
    isHot: true,
    mark: 3.8,
    comments: [
      {
        commentator: '',
        commentatorAvatar: '',
        commentContext: '',
        commentIssusTime: '',
      },
    ],
  },
  {
    groupId: 210102,
    reviewsId: '52501003',
    title: '自由快乐被卷进TACO里',
    primaryImage: 'https://img.meituan.net/content/2ab4b19eb3afcaaa742927c9db125cbb1241379.png',
    reviewContext:
      '美食文化需要碰撞，而TACO属于最喜欢碰撞的一种美食了。作为墨西哥街头特色的小吃之一，油腻与清爽的碰撞，现代与传统的碰撞……',
    images: [
      'https://qcloud.dpfile.com/pc/MwZOx7HJjoxfHV7D87hiRoIQaRSZIdg6fULnhlxXscmx6CJbDMzuLvbsbXyIeVdn0scohmss9LtJWg-k-u7I4UHdS9p3h7-h2wfpsWVfxX8nY08TQIxe-DkxF3-YDtNHvJLBPMnbGaim65JmQfWVIQ.jpg',
      'https://qcloud.dpfile.com/pc/mTnsX-hGfuFlyKEXwu3m9qjciNxhsWCrO-jLr3CdSqrmLdJDs7FZJYyzEaDeek-N0scohmss9LtJWg-k-u7I4UHdS9p3h7-h2wfpsWVfxX8nY08TQIxe-DkxF3-YDtNHvJLBPMnbGaim65JmQfWVIQ.jpg',
    ],
    likerNum: 192,
    author: '甜莓小茶茶',
    avatar: 'https://p0.meituan.net/userheadpicbackend/1004cc9bb09a55a3558d10387eba73f8251820.jpg',
    releaseTime: '2024-04-29',
    lastModifyTime: '2024-04-29 13:49:51',
    subcategory: [''],
    isHot: true,
    mark: 4.5,
    comments: [
      {
        commentator: '',
        commentatorAvatar: '',
        commentContext: '',
        commentIssusTime: '',
      },
    ],
  },
  {
    groupId: 210102,
    reviewsId: '52501004',
    title: '整体口味与重庆还原度非常高',
    primaryImage:
      'https://qcloud.dpfile.com/pc/llpsIBcCrfOPG5V5HbXj6fWiOKwgbpb-Bo48KkW4QghaGEp6KxG-mWNJhJlVr9On0scohmss9LtJWg-k-u7I4UHdS9p3h7-h2wfpsWVfxX8nY08TQIxe-DkxF3-YDtNHvJLBPMnbGaim65JmQfWVIQ.jpg',
    reviewContext: '整体口味与重庆还原度非常高，而且里的蔬菜都是从原产地发货，本市采购不到的。原汁原味！',
    images: [
      'https://qcloud.dpfile.com/pc/WPmMHfahXTPxn4pJQ8yNhWAM-hkYJcoWoda6tUCh52yO3MjNCxoHTfR3RqMY9K5i0scohmss9LtJWg-k-u7I4UHdS9p3h7-h2wfpsWVfxX8nY08TQIxe-DkxF3-YDtNHvJLBPMnbGaim65JmQfWVIQ.jpg',
      'https://qcloud.dpfile.com/pc/vYEHe7uyYpcjpjLG4BXs2QzVWUtdZTLRSH3s3Ok4jEG-6zXt4WIIgT93Hq3sVh9P0scohmss9LtJWg-k-u7I4UHdS9p3h7-h2wfpsWVfxX8nY08TQIxe-DkxF3-YDtNHvJLBPMnbGaim65JmQfWVIQ.jpg',
    ],
    likerNum: 45,
    author: '正在发财的韩小艾',
    avatar: 'https://p1.meituan.net/userheadpicbackend/67e14696c206ef5d992b396a700855f7146352.jpg',
    releaseTime: '2024-04-29',
    lastModifyTime: '2024-04-29 13:49:51',
    subcategory: [''],
    isHot: true,
    mark: 3.8,
    comments: [
      {
        commentator: '',
        commentatorAvatar: '',
        commentContext: '',
        commentIssusTime: '',
      },
    ],
  },
];

/**
 * @param {string} id
 * @param {number} [available] 库存, 默认1
 */
export function genReview(id, isDetails = false) {
  
  if (isDetails) {
    return allReviews.filter((review) => review.reviewsId === id)[0];
  }

  const item = allReviews[id % allReviews.length];
  return {
    ...item,
    spuId: `${id}`,
    available: 1,
    desc: item?.desc || defaultDesc,
    images: item?.images || [item?.primaryImage],
  };
}
